<!DOCTYPE html>
<html>

	<head>
		<meta charset="utf-8">
		<title>HOME</title>
		<meta name="viewport" content="width=device-width, initial-scale=1,maximum-scale=1,user-scalable=no">
		<meta name="apple-mobile-web-app-capable" content="yes">
		<meta name="apple-mobile-web-app-status-bar-style" content="black">

		<!--标准mui.css-->
		<link rel="stylesheet" href="../css/mui.min.css">
		<!--App自定义的css-->
		<!--<link rel="stylesheet" type="text/css" href="../css/app.css" />-->
		<script src="../script/mui.min.js" type="text/javascript" charset="utf-8"></script>

		<style type="text/css">
			.item {} .count {
				font-size: 14px;
			}
			.hastest {
				font-size: 16px;
			}
			.parentNode {
				background-color: #f8f8fa;
				border-left: 4px solid #30a4ed;
			}
			.mui-table-view-cell.mui-active {
				/*border-left: 4px solid #51d1c2;*/
			}
			.mui-table-view {
				background-color: #f8f8fa;
				color: #fff;
			}
			.mui-table-view-chevron .mui-table-view-cell {
				/*margin-left: -4px;*/
				
				height: 80px;
				background-color: #f8f8fa;
				color: #51d1c2;
				border-left: 4px solid #51d1c2;
			}
			.mui-table-view-chevron .mui-table-view-cell p {
				color: #51d1c2;
			}
			.mui-table-view-cell:after {
				background-color: #e2e2e4;
				right: 15px;
				/*background-color: #c8c7cc;*/
				/*right: 15px;*/
			}
			.mui-table-view-cell.mui-collapse .mui-table-view .mui-table-view-cell:after {
				background-color: #e2e2e4;
				left: 11px;
				right: 66px;
			}
			.mui-table-view-chevron .mui-table-view-cell:first-child:before {
				position: absolute;
				top: 0;
				right: 66px;
				left: 15px;
				height: 1px;
				content: '';
				-webkit-transform: scaleY(.5);
				transform: scaleY(.5);
				background-color: #e2e2e4;
			}
		</style>

	</head>

	<body>
		<!--<div class="mui-content">-->
		<ul class="mui-table-view" id="list">
		</ul>
		<!--</div>-->
	</body>
	<script type="text/html" id="listTem">
		{{each}}
		<li class="mui-table-view-cell" onclick="openTest({{$value.testid}})">
			<a class="parentNode" style="line-height: 24px;" tapmode>
				<p class="mui-ellipsis-2 mui-pull-left" style="width: 90%;font-size: 16px;">{{$value.papername}}</p>
				<span class="mui-pull-right" style="padding: 5px 5px;"><img src="../image/edit2.png" style="height: 30px;"/></span>
			</a>
		</li>
		{{/each}}
	</script>
	<script src="../script/app.js" type="text/javascript" charset="utf-8"></script>
	<script src="../script/template.js" type="text/javascript" charset="utf-8"></script>
	<script type="text/javascript">
		MYPAGE = {};

		function openTest(id) {
			var key = getUserKey();
			var data = {
				testid: id,
				key: key,
				type: "wrong"
			}
			api.openWin({
				name: 'testanalysis',
				url: 'testanalysis.html',
				pageParam: data
			});
		}

		function loadList() {
			showWaiting("稍等一下哦！");
			var key = getUserKey();
			var data = {
				key: key
			};
			var url = MYAPP.webroot + "/api/index.php/Home/Index/myTestList";
			api.ajax({
				url: url,
				method: 'post',
				timeout: 30,
				dataType: 'json',
				data: {
					values: data
				},
				returnAll: false
			}, function(ret, err) {
				if (ret) {
					success(ret);
				} else {
					api.toast({
						msg: '错误码：' + err.code + '；错误信息：' + err.msg + '网络状态码：' + err.statusCode,
						location: 'middle',
						duration: 1000
					});
				}
			});
		}

		function success(ret) {
			if (ret.data.length > 0) {
				var html = template('listTem', ret.data);
				document.getElementById("list").innerHTML = html;
			} else {
				var html = '<li class="mui-table-view-cell"><p class="mui-text-center">暂时没有做过的试卷哦！</p></li>';
				document.getElementById("list").innerHTML = html;
			}
			hideWaiting();
		}
		apiready = function() {
			loadList();
		}
	</script>

</html>